#coding=utf-8
'''
search 于最近3天创新高的share
'''

from stutils import set_django_environ
set_django_environ()

from stdj.stock.models import *
import datetime
td = datetime.date.today().isoformat()

def price_compare(p1, p2):
    return int(p2.end - p1.end) 
def price_set(share):
    return [ e.price for e in share.exday_set.all()]
       
for s in Share.objects.order_by('code')[200:400]:
    
    ps = price_set(s)
    ps.sort(price_compare)
    
    ds = [p.exday.date.isoformat() for p in ps[:5]]
    if td in ds:print s
    